const runDomain = "https://yly.gycloud.net.cn"
export default {
  // Disable server-side rendering: https://go.nuxtjs.dev/ssr-mode
  ssr: false,

  // Global page headers: https://go.nuxtjs.dev/config-head
  head: {
    title: 'yly-form-design',
    htmlAttrs: {
      lang: 'en'
    },
    meta: [
      { charset: 'utf-8' },
      { name: 'viewport', content: 'width=device-width, initial-scale=1' },
      { hid: 'description', name: 'description', content: '' },
      { name: 'format-detection', content: 'telephone=no' }
    ],
    link: [
      { rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
    ]
  },
  server:{
    port: 8088
  },
  // Global CSS: https://go.nuxtjs.dev/config-css
  css: [
    // 'vant/lib/index.css'
  ],

  // Plugins to run before rendering page: https://go.nuxtjs.dev/config-plugins
  plugins: [
    '@/utils/request',
    '@/plugins/ant-design',
    '@/plugins/axios/index',
    '@/plugins/form-source/index',
  ],
  axios: {
    proxy: true
    // See https://github.com/nuxt-community/axios-module#options
  },
  proxy: {
    '/onlcode': {
      target: runDomain,
      changeOrigin: true
    },
    '/yly-common': {
      target: 'http://yly.gycloud.net.cn/', // 请求本地 需要yly-common-active后台项目
      changeOrigin: true
    },
    '/yly-base' : {
      target: 'http://gycloud.net.cn/',
      changeOrigin: true,
      pathRewrite:{
        '^/yly-base': '/'
      }
    },
    '/yly-common/bifrost':{
      target: 'http://106.14.107.173:8080/', // 请求本地 需要yly-common-active后台项目
      changeOrigin: true,
      pathRewrite:{
        '^/yly-common': '/'
    }
    },
    '/gsc01': {
      target: "http://yly.gycloud.net.cn", // 请求本地 需要yly-common-active后台项目
      changeOrigin: true,
    },
  },
  // Modules for dev and build (recommended): https://go.nuxtjs.dev/config-modules
  buildModules: [
  ],

  // Modules: https://go.nuxtjs.dev/config-modules
  modules: [
    '@nuxtjs/axios', // axios模块,
  ],
  // Build Configuration: https://go.nuxtjs.dev/config-build
  build: {
    postcss: null,
    babel:{
      plugins:[
      ]
    },
    extend(config, { isClient , isDev}) {
      config.resolve.alias['vue'] = 'vue/dist/vue.common'
      // 为 客户端打包 进行扩展配置
      config.node = {
        fs: 'empty'
      }
      if(isDev) {
        config.devtool = 'eval-source-map' // 开启本地开发调试
      }
      config.externals = {
      }
    }
  }
}
